package com.sdy.healthcode.biz.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sdy.healthcode.biz.dto.ExpertsAppointmentDTO;
import com.sdy.healthcode.biz.dto.GetAppointmentDTO;
import com.sdy.healthcode.biz.dto.cockpit.CockpitAppointmentStatistic;
import com.sdy.healthcode.biz.model.ExpertsAppointment;
import com.sdy.mvc.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 用户-专家预约表 Mapper 接口
 * </p>
 *
 * @author zzq
 * @since 2020-03-04
 */
public interface ExpertsAppointmentMapper extends BaseMapper<ExpertsAppointment> {

    /**
     * 获取某个时间段预约记录
     *
     * @param appointmentDateBeginStr 开始时间 eg. '2019-01-01'
     * @param appointmentDateEndStr   结束时间 eg. '2019-01-01'
     */
    List<ExpertsAppointment> listAppointmentByMap(@Param("doctorId") Integer doctorId,
                                                  @Param("deptId") Integer deptId,
                                                  @Param("appointmentDateBeginStr") String appointmentDateBeginStr,
                                                  @Param("appointmentDateEndStr") String appointmentDateEndStr);

    /**
     * 统计预约人数
     *
     * @param dateStr eg. '2019-01-01'
     */
    Integer countHospitalIn(@Param("dateStr") String dateStr);

    /**
     * 查询预约记录情况
     *
     * @param state
     * @param docStat
     * @param name
     * @param startTime
     * @param endTime
     * @param current
     * @param size
     * @return
     */
    List<GetAppointmentDTO> getAppointmentPageList(@Param("state") Integer state,
                                                   @Param("docState") Integer docStat,
                                                   @Param("name") String name,
                                                   @Param("startTime") String startTime,
                                                   @Param("endTime") String endTime,
                                                   @Param("current") Long current,
                                                   @Param("size") Long size
    );

    /**
     * 查询预约记录情况
     *
     * @param state
     * @param docStat
     * @param name
     * @param startTime
     * @param endTime
     * @return
     */
    Integer getAppointmentPageCount(@Param("state") Integer state,
                                    @Param("docState") Integer docStat,
                                    @Param("name") String name,
                                    @Param("startTime") String startTime,
                                    @Param("endTime") String endTime
    );

    List<CockpitAppointmentStatistic> deptAppointmentMap();

    /**
     * 用户预约信息分页
     */
    IPage<ExpertsAppointmentDTO> pageExpertsAppointmentInfo(Page<ExpertsAppointmentDTO> page,
                                                            @Param("userId") Integer userId,
                                                            @Param("state") Integer state,
                                                            @Param("dateStr") String dateStr);

    /**
     * 用户预约信息分页
     */
    List<ExpertsAppointmentDTO> listExpertsAppointmentInfo(@Param("userId") Integer userId,
                                                           @Param("state") Integer state,
                                                           @Param("dateStr") String dateStr,
                                                           @Param("deptId") Integer deptId);

    /**
     * 用户预约信息分页
     */
    Integer countPatientAppointmentInfo(@Param("cardId") String cardId,
                                                           @Param("state") Integer state,
                                                           @Param("dateStr") String dateStr,
                                                           @Param("deptId") Integer deptId);
}
